﻿namespace LK
{
	namespace Functional
	{
		/**@brief 表示一个委托(引用)*/
		struct PDelegates :ptr<Object>
		{
			PMETHODS(PDelegates, IDelegates);
			/**
			@brief 获取函数对象数组的引用*/
			ptr<Collection::IArray<PFunObjs>>& GetFunObjsArrayRef()const;
#ifdef SUPPORT_VARIADIC_TEMPLATES
			/**
			@brief 调用并多播，不处理返回值*/
			template<class ...ArgumentsType>void operator()(ArgumentsType...t)const;
#else
#define TMPF(x)\
	template<MF4_RepeatAsc_(class T,,1,x)>void operator()(MF4_RepeatAsc_(T,,1,x))const;
	MF2_Repeatb(TMPF, _MRP_CNTM2)
	inline void operator()()const;//无法声明为模板

#undef TMPF
#endif
			/**
			@brief 从函数对象构造*/
			PDelegates(PFunObjs const&);
			/**
			@brief 添加一个委托*/
			PDelegates& operator+=(PDelegates const&d);
			/**
			@brief 移除一个委托*/
			PDelegates& operator-=(PDelegates const&d);
			/**
			@brief 添加一个函数对象*/
			PDelegates& operator+=(PFunObjs const&d);
			/**
			@brief 移除一个函数对象*/
			PDelegates& operator-=(PFunObjs const&d);
		};
		/**@brief 表示一个委托*/
		struct IDelegates :ICloneables
		{
			BMETHODS(PDelegates, IDelegates)
			/**
			@brief 返回一个浅表副本*/
			IDelegates* Clone()const { return new IDelegates(*this); }
			/**
			@brief 存放函数对象的数组*/
			ptr<Collection::IArray<PFunObjs>> funarr;
			/**
			@brief 传入ptr<Object>封装的参数并进行多播调用*/
			ptr<Object> Invoke(ptr<Object> const& obj, ptr<Collection::IArray<ptr<Object>>>args)const
			{
				if (funarr==null)return ptr<Object>();
				Collection::IArray<PFunObjs>::const_iterator it = funarr.begin();
				ptr<Object> t;
				while (it != funarr.end())t = (*it++)->Call(obj, args);
				return t;
			}
#ifdef SUPPORT_VARIADIC_TEMPLATES
			/**
			@brief 调用并多播，不处理返回值（如果内部没有函数则直接返回）*/
			template<class ...ArgumentsType>void operator()(ArgumentsType...t)const
			{
				if (funarr==null)return;
				using namespace Collection;
				IArray<PFunObjs>::const_iterator it = funarr.begin();
				ptr<IArray<ptr<Type>>> check = new Vector<ptr<Type>>(Type::GetTypesFromArgs<VarArgsPack<ArgumentsType...> >());
				ptr<IArray<ptr<Type>>> ch = (*it)->GetArgsType();
				if (check->size() != ch->size() - 2)Throw<PFunctionalException >(L"检测到传入的参数数量不正确：应传入" + ptr<String>(ch->size() - 2) + L"个参数，但传入了" + ptr<String>(check->size()) + L"个");
				for (index_t i = 0; i < check->size(); ++i)if (check[i] != ch[i + 2])Throw<PFunctionalException >(L"检测到传入的第" + ptr<String>(i + 1) + L"个参数类型不正确：应传入的参数类型是 " + ch[i + 2]->GetName() + L"，但传入的参数类型是 " + check[i]->GetName());
				void* args[VarArgsPack<ArgumentsType...>::ArgCount + 1];
				MakeArgs(args, Convert<void, ArgumentsType>::ToDataPtrFrom(t)...);
				while (it != funarr.end())//多播调用
				{
					(*it)->Call(NULL, NULL, args);
					++it;
				}
			}
			/**
			@brief 调用并多播（如果内部没有函数则直接返回），处理返回值，返回值将是最后一个被调用函数的返回值*/
			template<class ReturnType, class ...ArgumentsType>ReturnType Invoke(ArgumentsType...t)const
			{
				using namespace Collection;
				typedef typename UseT<IsVoid<ReturnType>::V, ReturnType, int>::T RT;
				PMObjects m;
				if (funarr==null)Throw<PPointerIsNullException >();
				m = MObjects::MakeMObjectByTypeInfo(Type::Make<RT>());
				IArray<PFunObjs>::const_iterator it = funarr.begin();
				if (cast< PFunObj<VarArgsPack<ReturnType, ArgumentsType...> > >(*it)==null)//如果检测到类型异常
				{
					ptr<IArray<ptr<Type>>> check = new Vector<ptr<Type>>(Type::GetTypesFromArgs<VarArgsPack<ArgumentsType...> >());
					ptr<IArray<ptr<Type>>> ch = (*it)->GetArgsType();
					if (check->size() != ch->size() - 2)Throw<PFunctionalException >(L"检测到传入的参数数量不正确：应传入" + ptr<String>(ch->size() - 2) + L"个参数，但传入了" + ptr<String>(check->size()) + L"个");
					if (Type::template Make<ReturnType>() != ch[0])Throw<PFunctionalException >(L"检测到指定的返回值参数类型不正确：函数返回类型是 " + ch[0]->GetName() + L"，但指定的类型是 " + Type::template Make<ReturnType>()->GetName());
					for (index_t i = 0; i < check->size(); ++i)if (check[i] != ch[i + 2])Throw<PFunctionalException >(L"检测到传入的第" + ptr<String>(i + 1) + L"个参数类型不正确：应传入的参数类型是 " + ch[i + 2]->GetName() + L"，但传入的参数类型是 " + check[i]->GetName());
				}
				void* args[VarArgsPack<ArgumentsType...>::ArgCount + 1];
				MakeArgs(args, Convert<void, ArgumentsType>::ToDataPtrFrom(t)...);
				while (it != funarr.end())//多播调用
				{
					(*it)->Call(MObjects::GetDataPtr(m), NULL, args);
					++it;
				}
				return Convert<ReturnType, void>::FromDataPtr(MObjects::GetDataPtr(m));
			}
			template <class ...Args>static inline void MakeArgs(void**p, void* p1, Args...t) { *p = p1; MakeArgs(p + 1, t...); }
			static inline void MakeArgs(void**p) {}
#else
#define TMPT_t(x) T##x t##x
#define TMPma(x) args[x-1] = Convert<void,T##x>::ToDataPtrFrom(t##x);
#define TMPF_(x)/**@brief 调用并多播，不处理返回值（如果内部没有函数则直接返回）*/\
				if (funarr==null)return;\
				using namespace Collection;\
				IArray<PFunObjs>::const_iterator it = funarr.begin();\
				ptr<IArray<ptr<Type>>> check = new Vector<ptr<Type>>(Type::GetTypesFromArgs<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> >());\
				ptr<IArray<ptr<Type>>> ch = (*it)->GetArgsType();\
				if (check->size() != ch->size() - 2)Throw<PFunctionalException >(L"检测到传入的参数数量不正确：应传入" + ptr<String>(ch->size() - 2) + L"个参数，但传入了" + ptr<String>(check->size())+L"个");\
				for (index_t i = 0; i < check->size(); ++i)if (check[i] != ch[i + 2])Throw<PFunctionalException >(L"检测到传入的第" + ptr<String>(i + 1) + L"个参数类型不正确：应传入的参数类型是 " + ch[i + 2]->GetName() + L"，但传入的参数类型是 " + check[i]->GetName());\
				void* args[x+1];\
				MF3_RepeatAsc(TMPma,1,x);\
				while (it != funarr.end()){\
					(*it)->Call(NULL, NULL, args);\
					++it;\
				}
#define TMPF(x) template<MF4_RepeatAsc_(class T,,1,x)>void operator()(MF3_RepeatAsc_(TMPT_t,1,x))const{TMPF_(x)}
			MF2_Repeatb(TMPF, _MRP_CNTM2)
				void operator()()const { TMPF_(0) }
#undef TMPF
#undef TMPF_
#undef TMPma
#define TMPma(x) args[x-2] = Convert<void,T##x>::ToDataPtrFrom(t##x);
#define TMPF_(x)/**@brief 调用并多播（如果内部没有函数则直接返回），处理返回值，返回值将是最后一个被调用函数的返回值*/\
				using namespace Collection;\
				typedef typename UseT<IsVoid<T1>::V, T1, int>::T RT;\
				PMObjects m;\
				if (funarr==null)Throw<PPointerIsNullException >();\
				m = MObjects::MakeMObjectByTypeInfo(Type::Make<RT>());\
				PArray<PFunObjs>::const_iterator it = funarr.begin();\
				if (cast< PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > >(*it)==null){\
					ptr<IArray<ptr<Type>>> check = new Vector<ptr<Type>>(Type::GetTypesFromArgs<VarArgsPack<MF4_RepeatAsc_(T,,2,x)> >());\
					ptr<IArray<ptr<Type>>> ch = it->GetArgsType();\
					if (check->size() != ch->size() - 2)Throw<PFunctionalException >(L"检测到传入的参数数量不正确：应传入" + ptr<String>(check->size() - 2) + L"个参数，但传入了" + ptr<String>(check->size()) + L"个");\
					if(ptr<Type>::template Make<ReturnType>()!= ch[0])Throw<PFunctionalException >(L"检测到指定的返回值参数类型不正确：函数返回类型是 " + ch[0].GetName() + L"，但指定的类型是 " + ptr<Type>::template Make<T1>().GetName());\
					for (index_t i = 0; i < check->size(); ++i)if (check[i] != ch[i + 2])Throw<PFunctionalException >(L"检测到传入的第" + ptr<String>(i + 1) + L"个参数类型不正确：应传入的参数类型是 " + ch[i + 2].GetName() + L"，但传入的参数类型是 " + check[i].GetName());}\
				void* args[x];\
				MF3_RepeatAsc(TMPma,2,x);\
				while (it != funarr.end()){\
					(*it)->Call(m.GetDataPtr(), NULL, args);\
					++it;	}\
				return Convert<T1, void>::FromDataPtr(m.GetDataPtr());
#define TMPF(x) template<MF4_RepeatAsc_(class T,,1,x)>T1 Invoke(MF3_RepeatAsc_(TMPT_t,2,x))const{TMPF_(x)}
			MF2_Repeatb(TMPF, _MRP_CNTM2)
#undef TMPT_t
#undef TMPma
#undef TMPF_
#undef TMPF
#endif
			inline IDelegates() {}
			inline IDelegates(PFunObjs const&f) { if (f!=null) { funarr = new LK::Collection::DefaultArray<PFunObjs>(1, f); } }
			/**
			@brief 添加一个委托*/
			IDelegates& operator+=(PDelegates const&d);
			/**
			@brief 移除一个委托*/
			IDelegates& operator-=(PDelegates const&d);
			/**
			@brief 添加一个函数对象*/
			IDelegates& operator+=(PFunObjs const&d);
			/**
			@brief 移除一个函数对象*/
			IDelegates& operator-=(PFunObjs const&d);
		};

#ifdef SUPPORT_VARIADIC_TEMPLATES
		template<class ReturnType, class ...ArgumentsType>struct PDelegate<ReturnType(ArgumentsType...) > :PDelegates{
			typedef IDelegate<ReturnType(ArgumentsType...) >iDelegate;
			PMETHODS(PDelegate, iDelegate);
			/**
			@brief 获取函数对象数组的引用*/
			Collection::PArray<PFunObj<VarArgsPack<ReturnType,ArgumentsType...> > >& GetFunObjsArrayRef()const { return (Collection::PArray<PFunObj<VarArgsPack<ReturnType,ArgumentsType...> > >&)PDelegates::GetFunObjsArrayRef(); }
			/**
			@brief 传参并调用，同Invoke*/
			ReturnType operator()(ArgumentsType...t)const;
			/**
			@brief 从函数对象构造*/
			PDelegate(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> > const&);
			/**
			@brief 添加一个委托*/
			PDelegate& operator+=(PDelegate const&d);
			/**
			@brief 移除一个委托*/
			PDelegate& operator-=(PDelegate const&d);
			/**
			@brief 添加一个函数对象*/
			PDelegate& operator+=(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> > const&d);
			/**
			@brief 移除一个函数对象*/
			PDelegate& operator-=(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> > const&d);
		};

		template<class ReturnType, class ...ArgumentsType>struct IDelegate<ReturnType(ArgumentsType...) > :IDelegates
		{
			typedef PDelegate<ReturnType(ArgumentsType...) >xDelegate;
			BMETHODS(xDelegate, IDelegate)
			/**
			@brief 传参并调用，同operator()*/
			ReturnType Invoke(ArgumentsType...t)const
			{
				using namespace Collection;
				PArray<PFunObjs > &arr = (PArray<PFunObjs > &)funarr;
				if (arr==null)return Convert<ReturnType, int const&>::RefFrom(0);
				typename IArray<PFunObjs >::const_iterator it = arr.begin();
				void* args[VarArgsPack<ArgumentsType...>::ArgCount + 1];
				MakeArgs(args, Convert<void, ArgumentsType>::ToDataPtrFrom(t)...);
				for (index_t i = 1; i < arr->size(); ++i)
				{
					(*it)->Call(NULL,NULL,args);
					++it;
				}
				typedef typename UseT<IsVoid<ReturnType>::V, ReturnType, int>::T RT;
				PMObjects m = MObjects::MakeMObjectByTypeInfo(Type::Make<RT>());
				(*it)->Call(MObjects::GetDataPtr(m), NULL, args);
				return Convert<ReturnType, void>::FromDataPtr(MObjects::GetDataPtr(m));
			}
			/**
			@brief 传参并调用，同Invoke*/
			ReturnType operator()(ArgumentsType...t)const { return Invoke(t...); }
			/**
			@brief 从函数对象构造*/
			IDelegate(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> >const &f) :IDelegates(f) {}
			/**
			@brief 添加一个委托*/
			IDelegate& operator+=(xDelegate const&d)
			{
				if (d==null || d->funarr==null)return*this;
				if (funarr==null)funarr = d->funarr->Clone();
				else funarr->AppendArray(d->funarr);
				return *this;
			}
			/**
			@brief 移除一个委托*/
			IDelegate& operator-=(xDelegate const&d)
			{
				IDelegates::operator-=(d);
				return *this;
			}
			/**
			@brief 添加一个函数对象*/
			IDelegate& operator+=(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> >const &d)
			{
				if (funarr==null)funarr = new LK::Collection::DefaultArray<PFunObjs>(1, Convert<PFunObjs,PObject>::RefFrom((PObject)d->Clone()));
				else funarr->Append(d);
				return *this;
			}
			/**
			@brief 移除一个函数对象*/
			IDelegate& operator-=(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> >const &d) { IDelegates::operator-=(d); return *this; }
		};

		/**@brief 传参并调用，同Invoke*/
		template<class ReturnType, class ...ArgumentsType>ReturnType PDelegate<ReturnType(ArgumentsType...) >::operator()(ArgumentsType...t)const { return Check()->operator()(t...); }
		/**@brief 从函数对象构造*/
		template<class ReturnType, class ...ArgumentsType>PDelegate<ReturnType(ArgumentsType...) >::PDelegate(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> > const&f) :PDelegates(new IDelegate<ReturnType(ArgumentsType...) >(f)) {}
		/**@brief 添加一个委托*/
		template<class ReturnType, class ...ArgumentsType>PDelegate<ReturnType(ArgumentsType...) >& PDelegate<ReturnType(ArgumentsType...)>::operator+=(PDelegate const&d) { if (d!=null) { if (*this==null)return *this = d; *GetPtr() += d; }return*this; }
		/**@brief 移除一个委托*/
		template<class ReturnType, class ...ArgumentsType>PDelegate<ReturnType(ArgumentsType...) >& PDelegate<ReturnType(ArgumentsType...) >::operator-=(PDelegate const&d) { if (d!=null &&*this!=null)*GetPtr() -= d; return*this; }
		/**@brief 添加一个函数对象*/
		template<class ReturnType, class ...ArgumentsType>PDelegate<ReturnType(ArgumentsType...) >& PDelegate<ReturnType(ArgumentsType...)>::operator+=(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> > const&d) { if (d!=null) { if (*this==null)return *this = d; *GetPtr() += d; }return*this; }
		/**@brief 移除一个函数对象*/
		template<class ReturnType, class ...ArgumentsType>PDelegate<ReturnType(ArgumentsType...)>& PDelegate<ReturnType(ArgumentsType...)>::operator-=(PFunObj<VarArgsPack<ReturnType,ArgumentsType...> > const&d) { if (d!=null && *this!=null)*GetPtr() -= d; return*this; }
		/**@brief 调用并多播，不处理返回值*/
		template<class ...ArgumentsType>void PDelegates::operator()(ArgumentsType...t)const { return Check()->operator() < ArgumentsType... > (t...); }
#else
#define TMPT_t(x) T##x t##x
#define TMPma(x) args[x-2] = Convert<void,T##x>::ToDataPtrFrom(t##x);
#define TMPF(x)\
		template<MF4_RepeatAsc_(class T,,1,x)>struct PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) > :PDelegates{\
			typedef IDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >iDelegate;\
			PMETHODS(PDelegate, iDelegate)\
			/**@brief 获取函数对象数组的引用*/\
			ptr<Collection::IArray<PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)>> > >& GetFunObjsArrayRef()const \
			{ return (ptr<Collection::IArray<PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > >>&)PDelegates::GetFunObjsArrayRef(); }\
			/**@brief 传参并调用，同Invoke*/\
			T1 operator()(MF4_RepeatAsc_(T,,2,x))const;\
			/**@brief 从函数对象构造*/\
			PDelegate(PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > const&);\
			/**@brief 添加一个委托*/\
			PDelegate& operator+=(PDelegate const&d);\
			/**@brief 移除一个委托*/\
			PDelegate& operator-=(PDelegate const&d);\
			/**@brief 添加一个函数对象*/\
			PDelegate& operator+=(PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > const&d);\
			/**@brief 移除一个函数对象*/\
			PDelegate& operator-=(PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > const&d);\
		};
		MF2_Repeatb(TMPF, _MRP_CNTM2)
#undef TMPF
#define TMPF(x)\
		template<MF4_RepeatAsc_(class T,,1,x)>struct IDelegate<T1(MF4_RepeatAsc_(T,,2,x)) > :IDelegates{\
			typedef PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >xDelegate;\
			BMETHODS(xDelegate, IDelegate)\
			/**@brief 传参并调用，同operator()*/\
			T1 Invoke(MF3_RepeatAsc_(TMPT_t,2,x))const{\
				using namespace Collection;\
				ptr<IArray<PFunObjs > > arr = (ptr<IArray<PFunObjs > > const&)funarr;\
				if (arr==null)return Convert<T1, int const&>::RefFrom(0);\
				typename ptr<IArray<PFunObjs > >::const_iterator it = arr.begin();\
				void* args[x];\
				MF3_RepeatAsc(TMPma,2,x);\
				for (index_t i=1;i<arr->size();++i){\
					(*it)->Call(NULL,NULL,args);\
					++it;	}\
				typedef typename UseT<IsVoid<T1>::V, T1, int>::T RT;\
				PMObjects m=MObjects::MakeMObjectByTypeInfo(Type::Make<RT>());\
				(*it)->Call(MObjects::GetDataPtr(m), NULL, args);\
				return Convert<T1, void>::FromDataPtr(MObjects::GetDataPtr(m));}\
			/**@brief 传参并调用，同Invoke*/\
			T1 operator()(MF3_RepeatAsc_(TMPT_t,2,x))const { return Invoke(MF4_RepeatAsc_(t,,2,x)); }\
			/**@brief 从函数对象构造*/\
			IDelegate(PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> >const &f) :IDelegates(f) {}\
			/**@brief 添加一个委托*/\
			IDelegate& operator+=(xDelegate &d){\
				if (d.funarr==null)return*this;\
				if (funarr==null)funarr = d->funarr->Clone();\
				else funarr->AppendArray(d->funarr);\
				return *this;}\
			/**@brief 移除一个委托*/\
			IDelegate& operator-=(xDelegate const&d){IDelegates::operator-=(d);return *this;}\
			/**@brief 添加一个函数对象*/\
			IDelegate& operator+=(PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > const&d){\
				if (funarr==null)funarr = new LK::Collection::DefaultArray<PFunObjs>(1, Convert<PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> >,PObject>::RefFrom((PObject)d->Clone()));\
				else funarr->Append(d);\
				return *this;}\
			/**@brief 移除一个函数对象*/\
			IDelegate& operator-=(IFunObj<T1(MF4_RepeatAsc_(T,,2,x)) > &d) { IDelegates::operator-=(d); return *this; }\
		};
			MF2_Repeatb(TMPF, _MRP_CNTM2)
#undef TMPF

#define TMPF(x)\
		/**@brief 传参并调用，同Invoke*/\
		template<MF4_RepeatAsc_(class T,,1,x)>T1 PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >::operator()(MF3_RepeatAsc_(TMPT_t,2,x))const{return Check()->operator()(MF4_RepeatAsc_(t,,2,x));}\
		/**@brief 从函数对象构造*/\
		template<MF4_RepeatAsc_(class T,,1,x)>PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >::PDelegate(PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > const&f) :PDelegates(new IDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >(f)) {}\
		/**@brief 添加一个委托*/\
		template<MF4_RepeatAsc_(class T,,1,x)>PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >& PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >::operator+=(PDelegate const&d) { if (d!=null) { if (*this==null)return *this = d; *GetPtr() += d; }return*this; }\
		/**@brief 移除一个委托*/\
		template<MF4_RepeatAsc_(class T,,1,x)>PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >& PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >::operator-=(PDelegate const&d) { if (d!=null &&*this!=null)*GetPtr() -= d; return*this; }\
		/**@brief 添加一个函数对象*/\
		template<MF4_RepeatAsc_(class T,,1,x)>PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >& PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >::operator+=(PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > const&d) { if (d!=null) { if (*this==null)return *this = d; *GetPtr() += d; }return*this; }\
		/**@brief 移除一个函数对象*/\
		template<MF4_RepeatAsc_(class T,,1,x)>PDelegate<T1(MF4_RepeatAsc_(T,,2,x)) >& PDelegate<T1(MF4_RepeatAsc_(T,,2,x))>::operator-=(PFunObj<VarArgsPack<MF4_RepeatAsc_(T,,1,x)> > const&d) { if (d!=null && *this!=null)*GetPtr() -= d; return*this; }
			MF2_Repeatb(TMPF, _MRP_CNTM2)
#undef TMPF
#define TMPF(x)\
		/**@brief 调用并多播，不处理返回值*/\
		template<MF4_RepeatAsc_(class T,,1,x)>void PDelegates::operator()(MF3_RepeatAsc_(TMPT_t,1,x))const{ return Check()->operator()<MF4_RepeatAsc_(T,,1,x)>(MF4_RepeatAsc_(t,,1,x)); }
			MF2_Repeatb(TMPF, _MRP_CNTM2)
			void PDelegates::operator()()const { return Check()->operator()(); }

#undef TMPT_t
#undef TMPma
#undef TMPF

#endif
	}
}
